package com.yc.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.bean.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 订单Mapper接口
 */
@Mapper
public interface OrdersMapper extends BaseMapper<Orders> {
    // 在OrdersMapper接口中添加
    @Select("SELECT orderStatus as status, count(1) as count FROM orders WHERE userId = #{userId} GROUP BY orderStatus")
    List<Map<String, Object>> countByStatusGroup(@Param("userId") Long userId);
}
